package com.pxx.service.service;

import com.pxx.item.pojo.SpecParam;
import com.pxx.item.pojo.SpectGroup;
import com.pxx.service.mapper.SpecGroupMapper;
import com.pxx.service.mapper.SpecParamMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpecService {
    @Autowired
    private SpecGroupMapper specGroupMapper;

    @Autowired
    private SpecParamMapper specParamMapper;

    public List<SpectGroup> queryGroupsByCid(Long cid) {
        SpectGroup spectGroup = new SpectGroup();
        spectGroup.setCid(cid);
        return specGroupMapper.select(spectGroup);
    }

    public List<SpecParam> queryParams(Long gid, Long cid, Boolean generic, Boolean searching) {
        SpecParam specParam = new SpecParam();
        specParam.setGroupId(gid);
        specParam.setCid(cid);
        specParam.setGeneric(generic);
        specParam.setSearching(searching);
        return specParamMapper.select(specParam);
    }
}
